class Food{

}
class Fruit extends Food{

}
class Apple extends Fruit{

}
class Banana extends Fruit{

}
class Plate<T>{
    public T plate;

    public T getPlate() {
        return plate;
    }
    public void setPlate(T plate) {
        this.plate = plate;
    }
}
public class Test3 {
    public static void fun(Plate<? super Fruit> tmp){
        tmp.setPlate(new Apple());
        tmp.setPlate(new Banana());
        tmp.setPlate(new Fruit());
        // tmp.setPlate(new Food());
        Object obj = tmp.getPlate();
        System.out.println(tmp.getPlate());
    }


    public static void main(String[] args) {
        Plate<Food> plate1 = new Plate<>();
        fun(plate1);

        Plate<Fruit> plate2 = new Plate<>();
        fun(plate2);
    }
    public static void fun1(Plate<? extends Fruit> tmp){
       /* tmp.setPlate(new Apple());
        tmp.setPlate(new Fruit());*/

        Fruit fruit = tmp.getPlate();
        System.out.println(fruit);
    }
    public static void main1(String[] args) {
        Plate<Apple> plate1 = new Plate<>();
        fun1(plate1);
        Plate<Banana> plate2 = new Plate<>();
        fun1(plate2);
    }

}

